<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="GridCommodity.GridCommodityShow" %>
<%@ page import="GridCommodity.GridCommodity" %>
<%@ page import="GridCommodity.GridCommodityDeal" %>
<%@ page import="Comment.CommentDeal"%>
<%@ page import="java.sql.*" %>
<%@ page import="Member.Member"%>
<script type="text/javascript" language="javaScript">
	function Com(url){
       window.location.href = ("../Comment/SaveComment.jsp?SellerID="+url);
	}
	function Look(url){
	   window.location.href = ("../Member/Member.jsp?DealID="+url);
	}
	function Buy(url,url1){
		 window.location.href = ("../Order/Order.jsp?ComID="+url+"&SellerID="+url1);
	}
</script>
<script lauguage="JavaScript">
<!--
	function validate(){
		var r0=document.form.r[0].checked||document.form.r[1].checked||document.form.r[2].checked||document.form.r[3].checked||document.form.r[4].checked;
		if(!r0){
			alert("请您选择！");
			return false;
		}
	} 
 -->
 </script>
<%@ page import="java.sql.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>格子铺里的商品 </title>
<link href="../css/rover.css" rel="stylesheet" type="text/css" />
</head>
  
<body>
 <%
  String jp=request.getParameter("jp");
  String GridComID=request.getParameter("GridComID");
  GridCommodityShow a=new GridCommodityShow();
  ResultSet rs=a.CalGridCommodity(GridComID);
  GridCommodity GridCommodity=new GridCommodity();
  if(rs.next())
  {
	
	  GridCommodity.setComID(rs.getString(1));
	  GridCommodity.setComName(rs.getString(2));
	  GridCommodity.setConKind(rs.getString(3));
	  GridCommodity.setShowDate(rs.getString(4));
	  GridCommodity.setDescribe(rs.getString(5));
	  GridCommodity.setComImage(rs.getString(6));
	  GridCommodity.setSellCount(rs.getInt(7));
	  GridCommodity.setRemCount(rs.getInt(8));
	  GridCommodity.setViewCount(rs.getInt(9));
	  GridCommodity.setComPrice(rs.getFloat(10));
	  GridCommodity.setComInf(rs.getString(11));
	  GridCommodity.setGridID(rs.getInt(12));
	  GridCommodity.setRecency(rs.getInt(13));
  }
  %>
  <form name="From1" method="POST" action="SaveComment.jsp%>">
<div class="wrapper_first">
  <p class="title_first">当前位置 ： 东师格子铺 -----格子铺 </p>
</div>
<div class="title"><img src="../images/rover_1_03.png" />
 <div class="title_2"><select name="xuanze" class="xuanze_css"></select><input name="sousuo" type="text" class="sousuo" /></div>
    <div class="sousuoDiv"><input name="queren" type="button"  class="souduoqueren"/></div>
</div>
  <%
						String ID=a.CalMemID(GridCommodity.getGridID());
	%>
<div class="wrapper_left_prod">
  <div class="title_proInfo">TOP</div>
  <div class="wrapper_baseInfo">
   	<h1 class="title_baseInfo">商品基本信息</h1>
      <img src=<%="../"+GridCommodity.getComImage()%> class="img_baseInfo" />
      <div class="baseInfoPro">
       	  <span>商品名称：<%= GridCommodity.getComName()%></span><br/>
          <span>商品编号：<%= GridCommodity.getComID()%></span><br/>
          <span>商品类别：<%= GridCommodity.getConKind()%></span><br/>
          <span>商品价格：<%= GridCommodity.getComPrice()%></span><br/>
           <span>所在格子编号:<%= GridCommodity.getGridID()%></span><br/>
          <span>上架日期:<%= GridCommodity.getShowDate()%></span><br/>
          <span>售出量:<%= GridCommodity.getSellCount()%></span><br/>
          <span>剩余量:<%= GridCommodity.getRemCount()%></span><br/>
          <span>浏览量:<%= GridCommodity.getViewCount()%></span><br/>
          <span>新旧程度:<%= GridCommodity.getRecency()%></span>
          <input type= "button" value="购买"   onclick="Buy('<%=GridCommodity.getComID()%>','<%=ID%>')">
      </div>
      
      <h2 class="title_proIntro">产品介绍:</h2>
      <div class="wrapper_proIntro">
      	<span><%= GridCommodity.getComInf()%></span><br/>
      </div>
  </div>
</div>
<div class="wrapper_right_prod">
	<div class="border_rightList">
	<ul class="ul_oneKey">
        	<li><a href="">运动休闲</a></li>
            <li><a href="">礼品服饰</a></li>
            <li><a href="">个人闲置</a></li>
            <li><a href="">图书类</a></li>
            <li><a href="">数码产品</a></li>
            <li><a href="">电脑周边</a></li>
      </ul>
        <br clear="all" />
    </div>
</div>
<div class="sellerInfor">
<input type= "button" value="查看卖家信息"   onclick="Look('<%=ID%>')">
<%
	  ResultSet rs1=a.CalSellInfo(ID);
	  Member Member=new Member();
	  if(rs1.next())
	  {
		
		  Member.setMemID(rs1.getString(1));
		  Member.setMemTel(rs1.getString(3));
		  Member.setMemShow(rs1.getString(10));
		  Member.setMemEmail(rs1.getString(11));
		  Member.setLastLogTime(rs1.getString(15));
  }
	
 %>
<ul class="sellerInfor_word">
	<li style="padding:10px">店主:<%=Member.getMemID()%></li>
    	<li style="padding:10px">联系电话:<%=Member.getMemTel()%></li>
        	<li style="padding:10px">个人简介:<%=Member.getMemShow()%></li>
            	<li style="padding:10px">邮箱:<%=Member.getMemEmail()%></li>
            	<li style="padding:10px">上次登录时间:<%=Member.getLastLogTime()%></li>
</ul>
<ul class="sellerInfor_word">
  <li></li>
</ul>
</div>
<div class="gridPingfen"> 
<div class="gridPingfen_1">
  <%
        CommentDeal Comment=new CommentDeal();
  		String SellerID=request.getParameter("SellerID");
        //String SellerID=Comment.CalSeller(GridID);
        Float Score=Comment.CalScore(SellerID);
  %>
  <form id="form" name="form" method="post" action="../Comment/SaveComment.jsp?SellerID=<%=SellerID%>" onSubmit="javaScript: return validate();">
<input name="r" type="radio" value="1" class="pingfenannniu" />1分
<input name="r" type="radio" value="2" class="pingfenannniu"/>2分
<input name="r" type="radio" value="3" class="pingfenannniu" />3分
<input name="r" type="radio" value="4" class="pingfenannniu"/>4分
<input name="r" type="radio" value="5" class="pingfenannniu"/>5分</div>

<%javax.servlet.http.Cookie cookies[]=request.getCookies();
		   boolean voted=false;
		   try{
		   for(int i=0;i<cookies.length;i++)
		   {
		   	if((cookies[i].getName().equals("votedCookie"))&&(cookies[i].getValue().equals("true")))
		   	{
		   		voted=true;
		   		break;
		   	}
		   }
		   }catch(Exception e){
			   e.printStackTrace();
		   }
		   
 	 	%>
 	 	<%if(!voted)
 	 	{
 	 	%>
 	 	<ul height=”50“，align="center">
 	 	<input type="submit" value="给卖家打分" name="sunmit" class="Grid_button" onclick="Com('<%=ID%>')">
 	 	</ul> 
 	 	<%}else{%>
 	 	<ul height=”50“，align="center">
 	 	<font color="red">已经投过票了</font>
 	 	</ul> 
 	 	<% 
 	 	}
 	 	%>
<span class="maijiadefen">卖家得分<%=Score%></span>
<span class="xiangxi"> <a href='../Comment/CommentDetailed.jsp?SellerID=<%=SellerID%>'>卖家详细得分</a></span>
</div>
</form>
</body>
</html>
